#ifndef __LINKED_STACK_H__
#define __LINKED_STACK_H__

#include <stddef.h>

typedef struct node {
  void *data;
  struct node *next;
} node;

typedef struct linked_stack_t {
  node *top;
  size_t size;
  size_t nmemb;
} Stack;

int stack_init(Stack **st, size_t size);
int stack_empty(const Stack *st);
size_t stack_nmemb(const Stack *st);
void stack_pop(Stack *st);
void *stack_top(const Stack *st);
int stack_push(Stack *st, const void *data);
void stack_destroy(Stack **st);

#endif // !__LINKED_STACK_H__
